package lapsnake.model.expr;

import java.awt.Color;
import java.awt.Component;
import java.awt.FlowLayout;

import javax.swing.BorderFactory;
import javax.swing.JLabel;
import javax.swing.JPanel;

import lapsnake.model.*;
import lapsnake.model.data.*;
import lapsnake.model.data.SingleChild;
import lapsnake.py.ast.ASTHelperFactory; import java.beans.PropertyVetoException;

import org.python.antlr.ast.*;

/**Wrapper class with helper functions for Attribute nodes*/
public class LapAttribute extends LapExpression {
	private SingleChild<LapExpression> instance = new SingleChild<>(this, LapExpression.class);
	private SingleChild<LapName> attribute = new SingleChild<>(this, LapName.class);
	
	public LapAttribute(PyAST pyAST, ChildField<? super LapAttribute> parent, Attribute node) throws PropertyVetoException {
		super(pyAST, parent, node);
		ASTHelperFactory.makeHelper(pyAST, instance, node.getInternalValue());
		ASTHelperFactory.makeHelper(pyAST, attribute, node.getInternalAttrName());
		buildTextNodes(node);
	}
	/*
	@Override
	public Component getCompactUI()
	{
		JPanel ui = new JPanel(new FlowLayout(FlowLayout.LEFT, 1, 1));
		ui.setBorder(BorderFactory.createLineBorder(Color.BLACK, 1, true));
		ui.add(instance.get().getCompactUI());
		ui.add(new JLabel("'s "));
		ui.add(attribute.get().getCompactUI());
		return ui;
	}*/
}
